﻿@model XPressify.Models.ProfileInfoModel
@using Omu.Awesome.Core;
@using Omu.Awesome.Mvc.Helpers;
@using XPressify.Controllers

@{
    ViewBag.Title = "Info";
}

@if (Model.Show)
{
    <h1>@Model.OwnerUser.FullName</h1>
    <br /> <br />
    
    <table>
        <tr>
            <td style="width:300px">
                Born:
            </td>
            <td>
                @Model.OwnerUser.Birthday.ToString("dd MMMM yyyy")
            </td>
        </tr>
        <tr>
            <td>
                Email:
            </td>
            <td>
                @Model.OwnerUser.Email
            </td>
        </tr>
        @if (Model.LoveRelationship != null)
        {
            <tr>
                <td>
                    Relationship status:
                </td>
                <td>
                    @Model.RelationshipType
                    @if (Model.LoveRelationshipUser != null && Model.LoveRelationshipUser.Id != Model.OwnerUser.Id)
                    {
                        <text> with </text>
                        @Html.ActionLink(Model.LoveRelationshipUser.FullName, "ProfileView", "Profile", new { id = Model.LoveRelationshipUser.Id }, new { style = "color:blue", @class = "nobtn" })
                    }
                </td>
            </tr>
        }
        <tr>
            <td>
                @if (Model.IsOwner)
                {
                    @Html.ActionLink("Events", "EventOwnerList", "Event", new { }, new { style = "color:blue", @class = "nobtn" }) 
                }
                else
                {
                    @(Html.MakePopupForm<EventController>(o => o.EventViewerList(Model.OwnerUser.Id, 1), title: "Events", height: 540, width: 900, okText: "", resizable: false, refreshOnSuccess: true))
                    @(Html.PopupFormActionLink<EventController>(o => o.EventViewerList(Model.OwnerUser.Id, 1), "Events", new { @class = "nobtn", style = "color:blue" }))
                }
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td>
                @if (Model.IsOwner)
                {
                    @Html.ActionLink("Pages", "PageOwnerList", "Page", new { }, new { style = "color:blue", @class = "nobtn" }) 
                }
                else
                {
                    @(Html.MakePopupForm<PageController>(o => o.PageViewerList(Model.OwnerUser.Id, 1), title: "Pages", height: 540, width: 900, okText: "", resizable: false, refreshOnSuccess: true))
                    @(Html.PopupFormActionLink<PageController>(o => o.PageViewerList(Model.OwnerUser.Id, 1), "Pages", new { @class = "nobtn", style = "color:blue" }))
                }
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td>
                @if (Model.IsOwner)
                {
                    @Html.ActionLink("Groups", "GroupOwnerList", "Group", new { }, new { style = "color:blue", @class = "nobtn" }) 
                }
                else
                {
                    @(Html.MakePopupForm<GroupController>(o => o.GroupViewerList(Model.OwnerUser.Id, 1), title: "Group", height: 540, width: 900, okText: "", resizable: false, refreshOnSuccess: true))
                    @(Html.PopupFormActionLink<GroupController>(o => o.GroupViewerList(Model.OwnerUser.Id, 1), "Group", new { @class = "nobtn", style = "color:blue" }))
                }
            </td>
            <td>
            </td>
        </tr>
        @if (Model.AllRelationshipChild.Count() > 0)
        {
            <tr>
                <td>
                    Childrens:
                </td>
                @foreach (var children in Model.AllRelationshipChild)
                {
                    <td>
                        - @Html.ActionLink(children.FullName, "ProfileView", "Profile", new { id = children.Id }, new { style = "color:blue", @class = "nobtn" }) <br />
                    </td>
                }
            </tr>
        }
        @if (Model.AllRelationshipParent.Count() > 0)
        {
            <tr>
                <td>
                    Parents:
                </td>
            @foreach (var children in Model.AllRelationshipParent)
            {
                <td>
                    - @Html.ActionLink(children.FullName, "ProfileView", "Profile", new { id = children.Id }, new { style = "color:blue", @class = "nobtn" }) <br />
                </td>
            }
            </tr>
        }
        @if (Model.AllRelationshipSibling.Count() > 0)
        {
            <tr>
                <td>
                    Siblings:
                </td>
            @foreach (var children in Model.AllRelationshipSibling)
            {
                <td>
                    - @Html.ActionLink(children.FullName, "ProfileView", "Profile", new { id = children.Id }, new { style = "color:blue", @class = "nobtn" }) <br />
                </td>
            }
            </tr>
        }
        @if (Model.AllRelationshipUncleAunt.Count() > 0)
        {
            <tr>
                <td>
                    Uncle/Aunt:
                </td>
            @foreach (var children in Model.AllRelationshipUncleAunt)
            {
                <td>
                - @Html.ActionLink(children.FullName, "ProfileView", "Profile", new { id = children.Id }, new { style = "color:blue", @class = "nobtn" }) <br />
                </td>
            }
            </tr>
        }
        @if (Model.AllRelationshipNephewNiece.Count() > 0)
        {
            <tr>
                <td>
                    Nephew/Niece:
                </td>
            @foreach (var children in Model.AllRelationshipNephewNiece)
            {
                <td>
                    - @Html.ActionLink(children.FullName, "ProfileView", "Profile", new { id = children.Id }, new { style = "color:blue", @class = "nobtn" }) <br />
                </td>
            }
            </tr>
        }
        @if (Model.AllRelationshipCousin.Count() > 0)
        {
            <tr>
                <td>
                    Cousin:
                </td>
            @foreach (var children in Model.AllRelationshipCousin)
            {
                <td>
                    - @Html.ActionLink(children.FullName, "ProfileView", "Profile", new { id = children.Id }, new { style = "color:blue", @class = "nobtn" }) <br />
                </td>
            }
            </tr>
        }
        @if (Model.AllRelationshipGrandparent.Count() > 0)
        {
            <tr>
                <td>
                    Grandparent:
                </td>
            @foreach (var children in Model.AllRelationshipGrandparent)
            {
                <td>
                - @Html.ActionLink(children.FullName, "ProfileView", "Profile", new { id = children.Id }, new { style = "color:blue", @class = "nobtn" }) <br />
                </td>
            }
            </tr>
        }
        @if (Model.AllRelationshipGrandchild.Count() > 0)
        {
            <tr>
                <td>
                    Grandchildren:
                </td>
            @foreach (var children in Model.AllRelationshipGrandchild)
            {
                <td>
                    - @Html.ActionLink(children.FullName, "ProfileView", "Profile", new { id = children.Id }, new { style = "color:blue", @class = "nobtn" }) <br />
                </td>
            }
            </tr>
        }
    </table>
    
   
    
}

